package com.chen.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.chen.pojo.User;
import com.chen.service.UserService;

@Controller
public class UserController {
	@Autowired
	private UserService userService;
	@ResponseBody
    @RequestMapping (value="addUser")
    public void  addUser(@RequestParam String name,@RequestParam String userPassword){
		System.out.println(name);
    	System.out.println("addUser");
    	User user =new User();
    	user.setId(user.genKey());
    	user.setUserName(name);
    	user.setUserPassword(userPassword);
    	userService.saveUser(user);
    	///SSM/pages/home/home.html.html
    	//照着这个改路径 就行了 你现在的路径是在/ssm/下 所以要先..,c
    	//return "../pages/home/home";  
        
    }
}
